home *** CD-ROM | disk | FTP | other *** search
- -- Colonel Behaviour script
- --
- -- Describes an individual that commands a party of varied size (2-6 not counting him).
- -- Upon danger, he sends a portion of the party ahead to check out the area, while he falls back with the rest.
- -- Upon player seen, he commands his subordinates to take cover between himself and the threat (Getting into
- -- attack position). Once in the attack position, he coordinates the attack by issuing cover fire commands combined
- -- with attack target commands. The group converges to the threat to ultimately destroy it.
- -- If alive when group number falls down to 50% of initial number, he radios for reinforcements and joins the
- -- attack on the threat. If left alone, he will try to secretly sneak out of the danger area and retreat towards
- -- a "safe point"
- --
- --------------------------
-
- AIBehaviour.Colonel = {
- Name = "Colonel",
- TeamMembersDead = 0,
- Activated = 0,
-
- InPosition = 0,
- GrenadeThrown = 0,
-
- Sounds = {
- getdown = Sound:Load3DSound("Sounds/e3ai/ry_get_down.wav"),
- move = Sound:Load3DSound("Sounds/e3ai/ry_move.wav"),
- pullback = Sound:Load3DSound("Sounds/e3ai/ry_pull_back.wav"),
- spreadout = Sound:Load3DSound("Sounds/e3ai/ry_spread_out.wav"),
- grenade = Sound:Load3DSound("Sounds/e3ai/ry_gernade.wav"),
- },
-
-
- -- SYSTEM EVENTS -----
- ---------------------------------------------
- OnSpawn = function(self,entity )
- AI:CreateGoalPipe(entity:GetName().."walk");
- -- AI:PushGoal(entity.GetName().."walk","signal",1,1,"FollowMeBoys",SIGNALFILTER_SUPERGROUP);
- -- AI:PushGoal(entity.GetName().."walk","bodypos",0,0);
- -- AI:PushGoal(entity.GetName().."walk","form",0,"woodwalk");
- -- AI:PushGoal(entity.GetName().."walk","run",0,0);
- AI:PushGoal(entity:GetName().."walk","locate",1,entity.Properties.pathname);
- AI:PushGoal(entity:GetName().."walk","pathfind",1,"");
- AI:PushGoal(entity:GetName().."walk","trace",1,0);
- -- AI:PushGoal(entity.GetName().."walk","signal",1,1,"ArrivedAtClearing",0);
-
- end,
- ---------------------------------------------
- OnActivate = function(self,entity )
- entity:SelectPipe(0,entity:GetName().."walk");
- end,
- ---------------------------------------------
- OnNoTarget = function( self,entity )
-
- end,
- ---------------------------------------------
- OnPlayerSeen = function( self,entity )
- if (entity.Behaviour.InPosition == 0) then
- return
- end
-
- if (entity.Behaviour.GrenadeThrown == 0) then
- entity:SelectPipe(0,"throwagrenate");
- return
- end
-
- entity:SelectPipe(0,"firesometime");
- end,
- ---------------------------------------------
- OnEnemySeen = function(self,entity )
-
- end,
- ---------------------------------------------
- OnEnemyMemory = function(self,entity )
- if (entity.Behaviour.InPosition == 0) then
- return
- end
-
- entity:SelectPipe(0,"wait&reload");
- end,
- ---------------------------------------------
- OnDeadFriendSeen = function(self,entity )
- end,
- ---------------------------------------------
- OnDeadEnemySeen = function(self,entity )
- end,
- ---------------------------------------------
- OnInterestingSoundHeard = function(self,entity )
-
- end,
- ---------------------------------------------
- OnThreateningSoundHeard = function( self,entity )
- if (entity.Behaviour.InPosition == 0) then
- return
- end
-
- entity:SelectPipe(0,"findlostenemy");
- end,
- ---------------------------------------------
- OnGunfireHeard = function(self,entity )
- end,
- ---------------------------------------------
- OnFootstepsHeard = function(self, entity )
- end,
- ---------------------------------------------
- OnGranateSeen = function( self,entity )
- end,
- ---------------------------------------------
- OnLongTimeNoTarget = function(self, entity )
- end,
- ---------------------------------------------
- OnGroupMemberDied = function( self,entity )
- entity.Behaviour.TeamMembersDead = entity.Behaviour.TeamMembersDead + 1;
- if ( entity.Behaviour.TeamMembersDead == 1) then
- entity:Say(entity.Behaviour.Sounds.pullback);
- entity:SelectPipe(0,"retreattotunnel");
- end
- end,
- ---------------------------------------------
- OnReceivingDamage = function (self,entity, shooter)
- end,
-
-
-
- -- CUSTOM
- -------------------------------------------------
- CallReinforcements = function(self,entity, sender)
- -- AI:Signal(SIGNALFILTER_ANYONEINCOMM,1,"Reinforcements",entity.id);
- entity:StartAnimation(0,"ssignal_sgetdown");
- end,
- ----------------------------------------------
- -- EveryonePRONE = function(self,entity, sender)
- -- entity.SelectPipe(0,"pronealerted");
- -- end,
- -------------------------------------------------
- PlayGetDownAnimation = function(self,entity, sender)
- entity:Say(entity.Behaviour.Sounds.getdown);
- entity:StartAnimation(0,"ssignal_sgetdown",0,0.5);
- end,
- -------------------------------------------------
- ArrivedAtClearing = function( self,entity, sender )
- entity:SelectPipe(0,"reformatclearing");
- end,
- -------------------------------------------------
- StayAlertMyself = function( self,entity, sender )
- entity:SelectPipe(0,"sendlarry");
- entity:StartAnimation(0,"sidle_loop",0,0.5);
- end,
- -------------------------------------------------
- PlayPointAnimation = function(self,entity, sender)
- entity:Say(entity.Behaviour.Sounds.move);
- entity:StartAnimation(0,"ssignal_sfocus",0,0.5);
- end,
- -------------------------------------------------
- SaySomethingBeforeThrow = function(self,entity, sender)
- entity:StartAnimation(0,"sgrenade");
- end,
- -------------------------------------------------
- ActuallyThrow = function(self,entity, sender)
- -- LAUNCH THE SMOKE GRENADE
- local rocket = Server:SpawnEntity("SmokeRocket");
- local pos = entity:GetPos();
- pos.z = pos.z+2;
- rocket:Launch(rocket,-1,entity,pos,entity:GetAngles(),{x=0.2,y=0.2,z=0.2});
- ----------------------------
- GRENADE_WAS_THROWN = 1;
- end,
- -------------------------------------------------
- LarryGoCheck = function(self,entity, sender)
- entity:SelectPipe(0,"pronealerted");
- end,
- -------------------------------------------------
- StakeOutTunnelEntrance = function( self,entity, sender )
- entity:Say(entity.Behaviour.Sounds.spreadout);
- entity:SelectPipe(0,"hidesomewhere");
- end,
- --------------------------------------------
- WaitForThePlayer = function( self,entity, sender )
- entity:SelectPipe(0,"standingthere");
- entity.Behaviour.InPosition = 1;
- end,
- --------------------------------------------
- GetBackToHidePlace = function( self,entity, sender )
- entity:SelectPipe(0,"hidealways");
- end,
- --------------------------------------------
- CheckEnemyPosition = function(self, entity, sender )
- entity:SelectPipe(0,"findlostenemy");
- end,
- --------------------------------------------
- ReEvaluate = function( self,entity, sender )
- entity.Behaviour.GrenadeThrown = 1;
- entity:SelectPipe(0,"findlostenemy");
- end,
- ----------------------------------------------
- PlayThrowAnimation = function (self,entity, sender)
- entity:Say(entity.Behaviour.Sounds.grenade);
- entity:StartAnimation(0,"sgrenade");
- end,
- }